import * as types from "../types/helpCenterTypes";
import NetWorkUtil from "../utils/NetWorkUtil";
import ApiConstants from "../common/ApiConstants";

export function getContent() {
  return dispatch => {
    dispatch({ type: types.HELPCENTER_INITING });
    NetWorkUtil.post(ApiConstants.HELPCENTER, {})
      .then(res => {
        dispatch({ type: types.HELPCENTER_DONE, content: res.content });
      })
      .catch(error => {
        dispatch({ type: types.HELPCENTER_ERROR, error });
      });
  };
}

export function getAbousContent() {
  return dispatch => {
    dispatch({ type: types.ABOUS_INITING });
    NetWorkUtil.post(ApiConstants.ABOUTUS, {})
      .then(res => {
        dispatch({ type: types.ABOUS_DONE, abousContent: res.content });
      })
      .catch(error => {
        dispatch({ type: types.ABOUS_ERROR, error });
      });
  };
}
